﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BitPortal.Models;
using BitPortal.Business;
using BitPortal.Utils;

namespace BitPortal
{
    public partial class PageContent : Controls.BaseFrontendPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        public override void BindMetaData()
        {
            base.BindMetaData();
            ltrNavigation.Text = "";
            Models.PortalPage p = PageBLL.GetByID(Request.QueryString["PageID"].ToInt32TryParse());
            if (p != null)
            {
                var parents = p.GetParents();
                for (int i = parents.Count - 1; i >= 0; i--)
                {
                    ltrNavigation.Text += " <li><a href=\"" + parents[i].GetSEOUrl() + "\" title=\"" + parents[i].Name + "\">" + parents[i].Name + "</a></li>";
                }
                ltrNavigation.Text += "<li>" + p.Name + "</li>";
                this.Title = p.Name;
                this.MetaDescription = p.Meta.MetaDescription;
                this.MetaKeywords = p.Meta.MetaKeyword;
            }            
        }
    }
}